package com.wy;

class Parent{
    static final Parent x = new Child();
}

class Child extends Parent{

}

/**
 *
 * thread1 拿到了初始化Parent的锁  然后去create Child时需尝试拿到Child的初始化的锁
 * thread2 拿到了初始化Child的锁 然后去尝试拿到Parent的初始化的锁
 * 然后就死了
 *
 *
 * */
public class DeadLock {
    public static void main(String[] args) {
        Thread two = new Thread(()->new Child());
        Thread one = new Thread(()->Parent.x.hashCode());
        two.start();
        one.start();
    }
}
